#include <memory>
#include <type_traits>
export module single;

export template<typename T>
class SingleInstanceTemplate
{
protected:
	SingleInstanceTemplate() noexcept = default;
	struct token_ {};
	SingleInstanceTemplate(const SingleInstanceTemplate<T>&) = delete;
	SingleInstanceTemplate
			    operator= (const SingleInstanceTemplate<T>&) = delete;
public:
	virtual ~SingleInstanceTemplate() {}
	static std::shared_ptr<T> getInstance() noexcept (std::is_nothrow_constructible_v<T>)
	{
		static std::shared_ptr<T> instance = std::make_shared<T>(token_());
		return instance;
	}
	
};